package com.lsyw.intergrate;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lsyw.intergrate.config.data.DynamicDataSourceConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@MapperScan(basePackages = "com.lsyw.intergrate.mapper", markerInterface = BaseMapper.class)
@EnableTransactionManagement
@EnableScheduling
@EnableCaching
@EnableAsync
//@EnableConfigurationProperties({CarCount.class})
@Import({DynamicDataSourceConfig.class})
public class IntegrateApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(IntegrateApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(IntegrateApplication.class, args);
        InetAddress address = null;//获取的是本地的IP地址 //PC-20140317PXKX/192.168.0.121
        try {
            address = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        String hostAddress = address.getHostAddress();
        System.out.println("********今天的IP是：" + hostAddress + "*********");
        System.out.println("==============================应用启动成功===========================");

    }

}
